<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2023/6/14
 * Time: 11:17
 */

namespace App\Rep;


use App\Models\Note;

class NoteRep
{

    public function getNoteListRep($params){
        return Note::where('is_del',2)->first();
    }

    public function createNoteRep($params){
        if(isset($params['id']) && !empty($params['id'])){
            $model = Note::where('id',$params['id'])->first();
        }else{
            $model = new Note();
        }
        if(isset($params['alias_name']) && !empty($params['alias_name'])){
            $model->alias_name = $params['alias_name'];
        }
        if(isset($params['access_key_id']) && !empty($params['access_key_id'])){
            $model->access_key_id = $params['access_key_id'];
        }
        if(isset($params['access_key_secret']) && !empty($params['access_key_secret'])){
            $model->access_key_secret = $params['access_key_secret'];
        }
        if(isset($params['sing_name']) && !empty($params['sing_name'])){
            $model->sing_name = $params['sing_name'];
        }
        if(isset($params['templatecode']) && !empty($params['templatecode'])){
            $model->templatecode = $params['templatecode'];
        }
        $model->save();
        return $model;

    }
}